/*
 * Copyright (C) 2015 Zhang Rui <bbcallen@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * https://github.com/Bilibili/jni4android
 * This file is automatically generated by jni4android, do not modify.
 */

#include "ReturnPrimitive.h"

typedef struct J4AC_test_ReturnPrimitive {
    jclass id;

    jmethodID method_getIntArray;
    jmethodID method_getFloatArray;
    jmethodID method_getDoubleArray;
} J4AC_test_ReturnPrimitive;
static J4AC_test_ReturnPrimitive class_J4AC_test_ReturnPrimitive;

jint J4AC_test_ReturnPrimitive__getIntArray(JNIEnv *env, jobject thiz, jintArray iArr)
{
    return (*env)->CallIntMethod(env, thiz, class_J4AC_test_ReturnPrimitive.method_getIntArray, iArr);
}

jint J4AC_test_ReturnPrimitive__getIntArray__catchAll(JNIEnv *env, jobject thiz, jintArray iArr)
{
    jint ret_value = J4AC_test_ReturnPrimitive__getIntArray(env, thiz, iArr);
    if (J4A_ExceptionCheck__catchAll(env)) {
        return 0;
    }

    return ret_value;
}

jfloat J4AC_test_ReturnPrimitive__getFloatArray(JNIEnv *env, jobject thiz, jfloatArray fArr)
{
    return (*env)->CallFloatMethod(env, thiz, class_J4AC_test_ReturnPrimitive.method_getFloatArray, fArr);
}

jfloat J4AC_test_ReturnPrimitive__getFloatArray__catchAll(JNIEnv *env, jobject thiz, jfloatArray fArr)
{
    jfloat ret_value = J4AC_test_ReturnPrimitive__getFloatArray(env, thiz, fArr);
    if (J4A_ExceptionCheck__catchAll(env)) {
        return 0;
    }

    return ret_value;
}

jdouble J4AC_test_ReturnPrimitive__getDoubleArray(JNIEnv *env, jobject thiz, jdoubleArray iArr)
{
    return (*env)->CallDoubleMethod(env, thiz, class_J4AC_test_ReturnPrimitive.method_getDoubleArray, iArr);
}

jdouble J4AC_test_ReturnPrimitive__getDoubleArray__catchAll(JNIEnv *env, jobject thiz, jdoubleArray iArr)
{
    jdouble ret_value = J4AC_test_ReturnPrimitive__getDoubleArray(env, thiz, iArr);
    if (J4A_ExceptionCheck__catchAll(env)) {
        return 0;
    }

    return ret_value;
}

int J4A_loadClass__J4AC_test_ReturnPrimitive(JNIEnv *env)
{
    int         ret                   = -1;
    const char *J4A_UNUSED(name)      = NULL;
    const char *J4A_UNUSED(sign)      = NULL;
    jclass      J4A_UNUSED(class_id)  = NULL;
    int         J4A_UNUSED(api_level) = 0;

    if (class_J4AC_test_ReturnPrimitive.id != NULL)
        return 0;

    sign = "test/ReturnPrimitive";
    class_J4AC_test_ReturnPrimitive.id = J4A_FindClass__asGlobalRef__catchAll(env, sign);
    if (class_J4AC_test_ReturnPrimitive.id == NULL)
        goto fail;

    class_id = class_J4AC_test_ReturnPrimitive.id;
    name     = "getIntArray";
    sign     = "([I)I";
    class_J4AC_test_ReturnPrimitive.method_getIntArray = J4A_GetMethodID__catchAll(env, class_id, name, sign);
    if (class_J4AC_test_ReturnPrimitive.method_getIntArray == NULL)
        goto fail;

    class_id = class_J4AC_test_ReturnPrimitive.id;
    name     = "getFloatArray";
    sign     = "([F)F";
    class_J4AC_test_ReturnPrimitive.method_getFloatArray = J4A_GetMethodID__catchAll(env, class_id, name, sign);
    if (class_J4AC_test_ReturnPrimitive.method_getFloatArray == NULL)
        goto fail;

    class_id = class_J4AC_test_ReturnPrimitive.id;
    name     = "getDoubleArray";
    sign     = "([D)D";
    class_J4AC_test_ReturnPrimitive.method_getDoubleArray = J4A_GetMethodID__catchAll(env, class_id, name, sign);
    if (class_J4AC_test_ReturnPrimitive.method_getDoubleArray == NULL)
        goto fail;

    J4A_ALOGD("J4ALoader: OK: '%s' loaded\n", "test.ReturnPrimitive");
    ret = 0;
fail:
    return ret;
}
